<linker>
  <assembly fullname="System.Private.CoreLib">
    <type fullname="System.Threading.ThreadPoolBoundHandle">
      <!-- Workaround to keep .interfaceimpl even though this type
             is not instantiated on unix:
             https://github.com/mono/linker/pull/649 -->
      <method name=".ctor" />
    </type>
  </assembly>

  <assembly fullname="System.Private.CoreLib" feature="System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting" featurevalue="true">
    <!-- Native hosting accesses managed methods from
    https://github.com/dotnet/runtime/blob/bbc898f3e5678135b242faeb6eefd8b24bf04f3c/src/native/corehost/hostpolicy/hostpolicy.cpp#L527-L538
    but ComponentActivator is not trimming safe. We persist the methods only when `_EnableConsumingManagedCodeFromNativeHosting` setting
    is enabled and only then we show the trimming warnings about possibly missing dependencies.
    -->
    <type fullname="Internal.Runtime.InteropServices.ComponentActivator">
      <method name="LoadAssembly" />
      <method name="LoadAssemblyBytes" />
      <method name="LoadAssemblyAndGetFunctionPointer" />
    </type>
  </assembly>

  <assembly fullname="System.Private.CoreLib">
    <!-- Rooting GetFunctionPointer allows for a reasonable error experience when using any form of native hosting on a trimmed app. -->
    <type fullname="Internal.Runtime.InteropServices.ComponentActivator">
      <method name="GetFunctionPointer" />
    </type>
  </assembly>

  <!-- Properties and methods used by a debugger. -->
  <assembly fullname="System.Private.CoreLib" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="true" featuredefault="true">
    <type fullname="System.Threading.Tasks.Task">
      <property name="ParentForDebugger" />
      <property name="StateFlagsForDebugger" />
      <property name="StateFlags" />
      <method name="GetDelegateContinuationsForDebugger" />
      <method name="SetNotificationForWaitCompletion" />
    </type>
    <type fullname="System.Threading.Timer">
      <property name="AllTimers" />
    </type>
    <type fullname="System.Threading.Tasks.TaskScheduler">
      <method name="GetScheduledTasksForDebugger" />
      <method name="GetTaskSchedulersForDebugger" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncMethodBuilderCore">
      <method name="TryGetStateMachineForDebugger" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncIteratorMethodBuilder">
      <property name="ObjectIdForDebugger" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncVoidMethodBuilder">
      <property name="ObjectIdForDebugger" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncTaskMethodBuilder">
      <property name="ObjectIdForDebugger" />
      <method name="SetNotificationForWaitCompletion" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1">
      <property name="ObjectIdForDebugger" />
      <method name="SetNotificationForWaitCompletion" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder">
      <property name="ObjectIdForDebugger" />
    </type>
    <type fullname="System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1">
      <property name="ObjectIdForDebugger" />
    </type>
    <type fullname="System.Threading.Tasks.Task">
      <!-- Methods is used by VS Tasks Window. -->
      <method name="GetActiveTaskFromId" />
    </type>

     <!-- methods used by hot reload -->
    <type fullname="System.Reflection.Metadata.MetadataUpdater">
      <method name="GetCapabilities" />
    </type>

    <!-- See https://github.com/dotnet/runtime/issues/71847 -->
    <type fullname="System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller/ManagedToUnmanagedIn">
      <method name="FromManaged" />
      <method name="ToUnmanaged" />
      <method name="Free" />
    </type>
  </assembly>
</linker>
